package com.aabbc.webflux;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.reactive.config.EnableWebFlux;
import reactor.core.publisher.Flux;

import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;

/**
 * WebfluxApplicationStarter
 *
 * @author: <a href="mailto:chenfenghai@oristartech.com">chenfenghai</a>
 * @version: 1.0
 * @date: 2019-12-02 16:33
 */
@EnableWebFlux
@SpringBootApplication
public class WebfluxApplicationStarter {

    public static void main(String[] args) {
        Flux.just("hello").subscribe(System.out::println);
        Flux.empty().subscribe(System.out::println);
        Flux.range(1, 9).subscribe(System.out::println);
        Flux.interval(Duration.of(10, ChronoUnit.SECONDS)).subscribe(System.out::println);
        Flux.fromArray(Arrays.asList("1","2","3").toArray()).subscribe(System.out::println);

        SpringApplication.run(WebfluxApplicationStarter.class, args);
    }
}
